package com.webbei.Backstage.action;

import java.io.File;
import java.io.IOException;

import org.apache.struts2.ServletActionContext;

import com.webbei.Backstage.service.BackstateSer;

public class deleteLabelPicByPicUrlAction {
	private BackstateSer bao;
	private String picUrl;
	public String execute(){
		
		System.out.println("need delete file name:"+picUrl);
		int i=bao.deleteLabelPicByPicUrl(picUrl);
		String path=ServletActionContext.getServletContext().getRealPath("/");
		File f=new File(path+picUrl);
		System.out.println("need delete file name realpath:"+path+picUrl);
		f.delete();
		try {
			ServletActionContext.getResponse().getWriter().write("success");
			ServletActionContext.getResponse().setContentType("text/html");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
	public BackstateSer getBao() {
		return bao;
	}
	public void setBao(BackstateSer bao) {
		this.bao = bao;
	}
	public String getPicUrl() {
		return picUrl;
	}
	public void setPicUrl(String picUrl) {
		this.picUrl = picUrl;
	}
	
}
